package cn.haoheng.org.service.impl;

<<<<<<< HEAD
import cn.haoheng.basic.utils.PageList;
import cn.haoheng.org.domain.Department;
import cn.haoheng.org.mapper.DepartmentMapper;
import cn.haoheng.org.query.DepartmentQuery;
=======

import cn.haoheng.basic.util.PageList;

import cn.haoheng.org.domain.Depatment;
import cn.haoheng.org.mapper.DepartmentMapper;
import cn.haoheng.org.query.DepartmentQuery;
import cn.haoheng.org.query.DepartmentQuery;
import cn.haoheng.org.service.IDepartmentService;
>>>>>>> cd5623cea15a20bb5abe36234dd14ce32c51e741
import cn.haoheng.org.service.IDepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional(readOnly = true,propagation = Propagation.SUPPORTS)
public class DepartmentServiceImpl implements IDepartmentService {

    @Autowired
    private DepartmentMapper departmentMapper;

    //添加
    @Override
    @Transactional
<<<<<<< HEAD
    public void add(Department department) {
        departmentMapper.save(department);
    }

    //修改
    @Override
    @Transactional
    public void update(Department department) {
=======
    public void add(Depatment department) {
        departmentMapper.save(department);
    }
    //修改
    @Override
    @Transactional
    public void update(Depatment department) {
>>>>>>> cd5623cea15a20bb5abe36234dd14ce32c51e741
        departmentMapper.update(department);
    }

    //删除
    @Override
    @Transactional
    public void remove(Long id) {
<<<<<<< HEAD
        departmentMapper.delete(id);
=======
       departmentMapper.delete(id);
>>>>>>> cd5623cea15a20bb5abe36234dd14ce32c51e741
    }

    //查询一条记录
    @Override
<<<<<<< HEAD
    public Department queryById(Long id) {
=======
    public  Depatment queryById(Long id) {
>>>>>>> cd5623cea15a20bb5abe36234dd14ce32c51e741

        return departmentMapper.loadById(id);
    }

    //查询所有
    @Override
<<<<<<< HEAD
    public List<Department> queryAll() {
=======
    public List<Depatment> queryAll() {
>>>>>>> cd5623cea15a20bb5abe36234dd14ce32c51e741

        return departmentMapper.loadAll();
    }

    //分页+高级查询
    @Override
    public PageList queryPage(DepartmentQuery query) {
        //先查询总数
        Long total = departmentMapper.queryCount(query);
        //再查询分页数据
<<<<<<< HEAD
        List<Department> rows = departmentMapper.queryData(query);
=======
        List<Depatment> rows = departmentMapper.queryData(query);
>>>>>>> cd5623cea15a20bb5abe36234dd14ce32c51e741
        return new PageList(total,rows);
    }
}
